/* $RCSFile: ExternalResourceProviderFactory.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.ExternalResourceProvider/ExternalResourceProviderFactory.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:30  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Web.Compilation;
using System.Threading;
using System.Diagnostics;
using System.Globalization;
using ADNCRM.CustomResourceProviders;

namespace ADNCRM.CustomResourceProviders.ExternalResourceProvider
{
    /// <summary>
    /// Provider factory implementation for external resources. Only supports
    /// global resources. 
    /// </summary>
    public class ExternalResourceProviderFactory : ResourceProviderFactory
    {

        public override IResourceProvider CreateGlobalResourceProvider(string classKey)
        {
            if ( ResourceTraceSwitch.Sw.TraceVerbose )
                Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "[V]ExternalResourceProviderFactory CreateGlobalResourceProvider classKey:({0})", classKey),ResourceTraceSwitch.Sw.Info);

            return new GlobalExternalResourceProvider(classKey);
        }

        public override IResourceProvider CreateLocalResourceProvider(string virtualPath)
        {
            throw new NotSupportedException(String.Format(Thread.CurrentThread.CurrentUICulture, Properties.Resources.Provider_LocalResourcesNotSupported, "ExternalResourceProviderFactory"));
        }
    }
}
